package com.rayboo.example.design.pattern.factory.abs;

/**
 * 抽象工厂
 * http://c.biancheng.net/view/1351.html
 */
public class Main {

    public static void main(String[] args) {
        Factory factory = new Factory();

        // suv
        CarFactory suvFactory = factory.create(Factory.SUV);
        Car redSuvCar = suvFactory.create(CarFactory.RED);
        Car greenSuvCar = suvFactory.create(CarFactory.GREEN);
        redSuvCar.run();
        greenSuvCar.run();

        // mpv
        CarFactory mpvFactory = factory.create(Factory.MPV);
        Car greenMpvCar = mpvFactory.create(CarFactory.GREEN);
        Car blueMpvCar = mpvFactory.create(CarFactory.BLUE);
        greenMpvCar.run();
        blueMpvCar.run();
    }
}
